package model.player;

public class ResourceManager 
{
	private int food, ore, energy;
	
	private static final int INIT_FOOD = 10000000,
						 	 INIT_ORE = 1000,
						 	 INIT_ENERGY = 1000;
	
	public ResourceManager()
	{
		food = INIT_FOOD;
		ore = INIT_ORE;
		energy = INIT_ENERGY;
	}
	
	public int getFoodAmount()
	{
		return food;
	}
	
	public int getOreAmount()
	{
		return ore;
	}
	
	public int getEnergyAmount()
	{
		return energy;
	}
	
	public void addFood(int amount)
	{
		food += amount;
	}
	
	public void addOre(int amount)
	{
		ore += amount;
	}
	
	public void addEnergy(int amount)
	{
		energy += amount;
	}
	
	public int takeFood(int amount)
	{
		if (amount > food)
			amount = food;
		
		food -= amount;
		
		return amount;
	}
	
	public int takeOre(int amount)
	{
		if (amount > ore)
			amount = ore;
		
		ore  -= amount;
		
		return amount;
	}
	
	public int takeEnergy(int amount)
	{
		if (amount > energy)
			amount = energy;
		
		energy -= amount;
		
		return amount;
	}
}
